home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2438 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: soap.news.pipex.net!pipex!usenet
  2. From: m.hendry@dial.pipex.com (Mathew Hendry)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: BatchFile Params
  5. Date: Wed, 31 Jan 96 14:29:30
  6. Organization: Private node.
  7. Distribution: world
  8. Message-ID: <19960131.476320.D1B0@an181.du.pipex.com>
  9. References: <DM1KJo.7z4@info.swan.ac.uk>
  10. NNTP-Posting-Host: an181.du.pipex.com
  11. X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
  12.  
  13. Your Name Here (your.E-Mail.name@Swansea.ac.uk) wrote:
  14. ^^^^^^^^^^^^^^
  15.  
  16. Oh dear, what were your parents thinking? ;)
  17.  
  18. : can somebody please tell me how to pass command line parameters into
  19. : a batch file
  20. : For example on the PC, the first parameter is %1, 2nd is %2 etc...
  21. : (BUT HOW DO YOU DO THIS ON THE AMIGA???)
  22. : This would make my life a hell of a lot easier if there is a way,
  23. : I've tried $1,$2, etc
  24.  
  25. At the beginning of your script, include something like the following (this
  26. example is taken from the standard S:SPAT script)
  27.  
  28. .key COM/A,PAT/A,OPT1,OPT2,OPT3,OPT4
  29. .bra {
  30. .ket }
  31.  
  32. The .key line indicates the format of the command line arguments - up to six
  33. arguments in this case, only two of which are compulsory, as indicated by
  34. their /A suffix. There are a number of other possible suffixes, which may
  35. be combined, though I can't remember all of these offhand.
  36.  
  37. The .bra and .ket lines tell the script interpreter how to delimit references
  38. to these arguments. The COM argument would be referenced by {COM} in this
  39. case. The delimiters are, by default, < and >.
  40.  
  41. Further down the script we have:
  42.  
  43. List >T:q{$$} {PAT} LFORMAT "{COM} *"%s%s*" {OPT1} {OPT2} {OPT3} {OPT4}"
  44.  
  45. which uses all the arguments passed to the script.
  46.  
  47. {$$} contains the current shell process number.
  48.  
  49. So if you typed "SPAT munch #?.food taste chew mangle swallow" in shell process
  50. 6, the above line in the SPAT script would be executed as:
  51.  
  52. List >T:q6 #?.food LFORMAT "munch *"%s%s*" taste chew mangle swallow"
  53.  
  54. -- Mat.
  55.